-- ================================START====================================
-- Template generated from		FRAMEWORKIVY CODE GENERATOR
-- Generator Version:			<1.0.0.0>
-- Template Creation Time:		<Sunday, 3 July, 2016   1:56:48 AM>
-- Template Modification Time:	<Sunday, 3 July, 2016   2:02:27 AM>
-- Code Generation Time:		<Wednesday, 6 July, 2016   1:35:18 PM>
-- Workstation ID:				<PRAVESH>
-- Current system User ID:		<pravesh>
-- Entity/Table Name:			<ProjectMemberMaster>
-- Description:					<SQL Server Stored Procedure For Update>
-- Template File:				<IvyGodeGenDefaultTemplate V1.1.xml>

-- Please modify the generated code as per requirement.
-- This code generator is just to speed up the stereo type codes
-- Complex logic needs to be modified manually.

-- This block of comments will not be included in
-- the definition of the procedure.
-- =========================================================================

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'Ivy_UserManagement_ProjectMemberMaster_Update')
	BEGIN
		DROP  Procedure  [Ivy_UserManagement_ProjectMemberMaster_Update]
	END
GO

CREATE PROCEDURE [Ivy_UserManagement_ProjectMemberMaster_Update]
-- =========================================================================
-- Created by				FRAMEWORKIVY CODE GENERATOR
-- Generator Version:		<1.0.0.0>
-- Template version used:   <1.0>
-- Template created by:		<Mrinmoy Das>
-- Code generated by:		<pravesh>
-- Code generation Time:	<Wednesday, 6 July, 2016   1:35:18 PM>
-- Entity/Table Name:		<ProjectMemberMaster>
-- Description:             <SQL Server Stored Procedure For Update>
-- =========================================================================

-- Add the parameters for the stored procedure here

	(
				@ProjectMemberKey int = NULL, 

				@ProjectMemberUserKey int = NULL, 
				@ProjectMemberFirstName varchar(50) = NULL, 
				@ProjectMemberLastName varchar(50) = NULL, 
				@ProjectMemberPrimaryEmailID varchar(150) = NULL, 
				@ProjectMemberCodePlexID varchar(50) = NULL, 
				@ProjectMemberSkypeID varchar(50) = NULL, 
				@ProjectMemberMicrosoftID varchar(50) = NULL, 
				@ProjectMemberGoogleID varchar(50) = NULL, 
				@ProjectMemberTimeZoneReference varchar(50) = NULL, 
				@ProjectMemberTimeZoneName varchar(250) = NULL, 
				@ProjectMemberTimeZoneAbbreviation varchar(50) = NULL, 
				@ProjectMemberCountryName varchar(150) = NULL, 
				@ProjectMemberCityName varchar(150) = NULL, 
				@ProjectMemberDateOfJoining datetime = NULL, 
				@ProjectMemberIsMemberOfFacebook bit = NULL, 

				@Sys_ModifiedByID varchar(50) = NULL, 
				@Sys_DeleteType int = NULL, 
				@Sys_IsDeleted bit = NULL, 
				@Sys_OrganizationID int = NULL, 
				@Sys_InitialPrimaryKeys varchar(MAX) = NULL, 
				@Sys_WorkstationName varchar(50) = NULL, 

				@ConcurrencyTimeStamp datetime = NULL, 

				@Sys_DateOfModification datetime OUTPUT 
	) 
AS 
BEGIN 
	-- SET NOCOUNT OFF added to indicate how many records are updated 
	SET NOCOUNT OFF; 

	-- ConcurrencyTimeStamp is mandatory for Update Stored Procedure. 
	-- It needs to check if any other user has changed the reord or not.
	IF @ConcurrencyTimeStamp = NULL 
	BEGIN 
		RAISERROR('Missing @ConcurrencyTimeStamp', 11,1); 
	END 
	DECLARE @CurrentModificationDate datetime; 
	SET @CurrentModificationDate = 
		(SELECT [Sys_DateOfModification] FROM [ProjectMemberMaster] WHERE 
			( 
				[ProjectMemberKey] = @ProjectMemberKey 
			) 
		); 

	If @ConcurrencyTimeStamp != @CurrentModificationDate 
	BEGIN 
		RAISERROR('Record is Changed by another process', 11,1); 
	END 

	IF @Sys_WorkstationName = 'Default' 
	BEGIN 
		SET @Sys_WorkstationName = (SELECT @@SERVERNAME); 
	END 

	SET @Sys_DateOfModification = GETDATE(); 

    UPDATE	[ProjectMemberMaster] 
	SET 
			[ProjectMemberUserKey] = @ProjectMemberUserKey, 
			[ProjectMemberFirstName] = @ProjectMemberFirstName, 
			[ProjectMemberLastName] = @ProjectMemberLastName, 
			[ProjectMemberPrimaryEmailID] = @ProjectMemberPrimaryEmailID, 
			[ProjectMemberCodePlexID] = @ProjectMemberCodePlexID, 
			[ProjectMemberSkypeID] = @ProjectMemberSkypeID, 
			[ProjectMemberMicrosoftID] = @ProjectMemberMicrosoftID, 
			[ProjectMemberGoogleID] = @ProjectMemberGoogleID, 
			[ProjectMemberTimeZoneReference] = @ProjectMemberTimeZoneReference, 
			[ProjectMemberTimeZoneName] = @ProjectMemberTimeZoneName, 
			[ProjectMemberTimeZoneAbbreviation] = @ProjectMemberTimeZoneAbbreviation, 
			[ProjectMemberCountryName] = @ProjectMemberCountryName, 
			[ProjectMemberCityName] = @ProjectMemberCityName, 
			[ProjectMemberDateOfJoining] = @ProjectMemberDateOfJoining, 
			[ProjectMemberIsMemberOfFacebook] = @ProjectMemberIsMemberOfFacebook, 

			[Sys_DateOfModification] = @Sys_DateOfModification, 
			[Sys_ModifiedByID] = @Sys_ModifiedByID, 
			[Sys_DeleteType] = @Sys_DeleteType, 
			[Sys_IsDeleted] = @Sys_IsDeleted, 
			[Sys_OrganizationID] = @Sys_OrganizationID, 
			[Sys_InitialPrimaryKeys] = @Sys_InitialPrimaryKeys, 
			[Sys_WorkstationName] = @Sys_WorkstationName 
	 WHERE 
		( 
			[ProjectMemberKey] = @ProjectMemberKey 
		); 

END 
GO 

-- =================================END=====================================

